﻿using System;
using System.Collections.Generic;
using System.Data.Objects;
using System.Linq;
using System.Text;
using System.Data.Entity;
using System.Data;
using MINERP.DAL;

namespace MINERP.DAL.LeaderOperate
{
    public class LeaderTask : DALBase
    {

        //private Entities entity =new Entities();
        /// <summary>
        /// 根据状态和可操作字串取得任务
        /// </summary>
        /// <param name="inStatus"></param>
        /// <param name="inOperate"></param>
        /// <returns></returns>       
        public ObjectQuery<WorkOrderFlowList> GetTaskByStatusAndOpe(int inStatus, string inOperate)
        {
            string TaskSQL = "where it.status={0} and it.TechId in {1} ";
            TaskSQL = string.Format(TaskSQL, inStatus, inOperate);
            ObjectQuery<WorkOrderFlowList> flowLists = DataEntites.WorkOrderFlowList.Where(TaskSQL).Include("orderInfo");
            return flowLists;
        }
        /// <summary>
        /// 根据工号查找员工信息
        /// </summary>
        /// <param name="inUserId"></param>
        /// <returns></returns>
        public users GetUserById(int inUserId)
        {
            string userSql = "where it.userID={0}";
            userSql = string.Format(userSql, inUserId);
            ObjectQuery<users> userses = DataEntites.users.Where(userSql);
            if (userses.Count() > 0)
            {
                return userses.First();
            }
            else
            {
                return new users();
            }
        }
    }
}
